package com.mentorgen.tools.profile.instrument.bwfilter;

import java.util.List;
import java.util.Arrays;

public abstract class ClassBandwidthFilterer implements BandwidthFilter {
	
	List<String> includeList = Arrays.asList("java/sql",
			"javax/sql");
	
//	List<String> includeList = Arrays.asList("");
	
	List<String> excludeList = Arrays.asList("com/mentorgen/tools/profile",
			"net/sourceforge/jiprof",
			"com/mentorgen/tools/util/profile",
			"javax/",
			"java/",
			"org/osgi/framework/");
	
	public boolean allow(Object... objects){
		
		for (Object object : objects){
			
			if (object == null) return false;
			
			String className = (String) object;
			
			for (String includePackage : includeList)
				if (className.contains(includePackage))
					return true;
			
			for (String excludePackage : excludeList)
				if (className.contains(excludePackage))
					return false;
		}
		
		return true;
	}

}
